import axios from "axios"

const BACKEND_URL = "/api"
const TIMEOUT_VALUE = 1000 * 60


// 全局配置
const instance = axios.create({
    baseURL: BACKEND_URL,
    timeout: TIMEOUT_VALUE
})

// 请求拦截
instance.interceptors.request.use(
  config => {
    return config
  },
  err => Promise.reject(err)
)

// 响应拦截
instance.interceptors.response.use(
  res => {
    return res.data
  },
  err => Promise.reject(err)
)


// 导出也要导正确
export default instance